{{!
    This file is part of Moodle - http://moodle.org/

    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!
    @template tool_lp/evidence_summary

    Moodle template for the the summary of a single piece of evidence.

    Classes required for JS:
    * none

    Data attributes required for JS:
    * none

    Context variables required for this template:
    * actionuser User record from a user_summary_exporter
    * userdate User formatted date this evidence was created
    * grade Raw grade value if set
    * gradename Scale grade item
    * description Description of the evidence
    * url Optional url for the evidence

    Example context (json):
    { "actionuser": { "id": 1, "fullname": "Legend", "profileimageurlsmall": "https://secure.gravatar.com/avatar/78f83716ad197a25e175fbb747cff1ff?s=35&d=mm" },
      "userdate": "Tuesday...",
      "grade": 2,
      "gradename": "Met",
      "description": "The user competency was manually rated in the plan Personal plan A",
      "url": "http://moodle.org/",
      "candelete": true,
      "id": 1
    }
}}
<div class="well well-small evidence" data-region="evidence" data-id="{{id}}">
    {{#candelete}}
        <div class="pull-right">
            <a href="#" data-action="delete-evidence">{{#pix}}t/delete{{/pix}}</a>
        </div>
    {{/candelete}}
{{#actionuser}}
    <div>
        {{> tool_lp/user_summary }}
    </div>
{{/actionuser}}
<strong><time datetime="{{userdate}}">{{userdate}}</time></strong>
{{#grade}}
    <p><span class="label">{{gradename}}</span></p>
{{/grade}}
<p>{{description}}</p>
{{#note}}
    <blockquote>{{note}}</blockquote>
{{/note}}
{{#url}}
    <p><a href="{{url}}" target="_blank" rel="noreferrer">{{url}}</a></p>
{{/url}}
</div>

{{#js}}
require(['tool_lp/evidence_delete'], function(EvidenceDelete) {
    EvidenceDelete.register('[data-action="delete-evidence"]', '[data-region="evidence"]');
});
{{/js}}
